<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>添加店铺</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
</head>

<body>
    <script src="/static/layui/layui.js"></script>
    <script>
    //Demo
    layui.use('form', function() {
        var form = layui.form;
        var $ = layui.jquery;

        form.on('submit(addStore)', function(data) {
            var datas = "shop="+JSON.stringify(data.field);

            $.ajax({
                url: "http://10.12.25.65:8081/v1/apis/shop/addShop",
                data: datas,
                type: "GET",
                dataType: "json",
                success: function(res) {
                    console.log(JSON.stringify(res));
                    if (res.code === 0) {
                    	alert("添加店铺成功");
                    } else {
                    	alert(res.msg);
                    }
                },
                error: function(error) {
                    alert(JSON.stringify(error));
                }
            });
            return false;
        });

    });
    </script>
    <div class="layui-container">
        <div class="layui-main" style="height: 100"></div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>请填写店铺资料</legend>
        </fieldset>
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">店铺名称</label>
                <div class="layui-input-block">
                    <input type="text" name="ShopName" required lay-verify="required" placeholder="请输入店铺名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">店铺地址</label>
                <div class="layui-input-block">
                    <input type="text" name="Address" required lay-verify="required" placeholder="请输入店铺详细地址" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-block">
                    <input type="text" name="Tel" required lay-verify="required|phone" placeholder="请输入店铺联系电话" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系邮箱</label>
                <div class="layui-input-block">
                    <input type="text" name="Tel" required lay-verify="email" placeholder="请输入店铺联系电话" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">店铺简介</label>
                <div class="layui-input-block">
                    <textarea name="desc" placeholder="请输入店铺简介内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit='' lay-filter="addStore">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</body>

</html>